home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Full
/
Paragon Drive Backup 9
/
DB90_SE_x64.msi
/
Data1.cab
/
_748DA16631159A583D99D8CC072C7898
< prev
next >
Wrap
Text File
|
2008-06-28
|
4KB
|
135 lines
/*
* This script creates incremental backups
* If quantity of incremental backups more than specified number
* than this script deletes all incremental backups and creates
* simple backup
*/
// Turn off all questions and confirmations
confirm off
// Print some text
print "Clever backup of partition"
print ""
/*
* Set some variables:
* ndisk - number of disk with which we want to work
* npart - number of partition which we want backup
* nsavedisk - number of disk on which we will backup
* nsavepart - number of partition on which we will backup
* narchs - maximum number of incremental backups
*/
set value ndisk = 0
set value npart = 1
set value nsavedisk = 0
set value nsavepart = 2
set value narchs = 10
// Setting header for filename: "/hard<N1>/partition<N2>/"
set string header = "/hard" + stringdec(value(nsavedisk)) + "/partition"
+ stringdec(value(nsavepart)) + "/"
// Sets file counter to 0
set value counter = 0
if (not(fileexist(string(header) + "backup.pbf")))
then
set value counter = value(narchs)
endif
/*
* Next some lines searches latest backup of partition
* We simply check existing of files with
* predefined filenames
*/
jump:
if (fileexist(string(header) + "backup" + stringdec(value(counter)) + ".pbf"))
then
set value counter = value(counter) + 1
goto jump
endif
// Ok, in counter we have number of files
if (value(counter) < value(narchs))
then
set value need_additional = 0
endif
else
set value need_additional = 1
endelse
if (value(need_additional) != 1)
then
// Incremental backup
print "Incremental backup of partition"
print ""
// Select filename for image
img = string(header) + "backup" + stringdec(value(counter)) + ".pbf"
base = string(header) + "backup.pbf"
unselect all
select disk value(ndisk) // Select disk
select partition value(npart) // Select partition
options
cmp = 1 // Compression = 1
label = "Incremental backup" // Label
base_pwd = "" // Password to base archive
autonames // Create names automatically
store // Backup
call something_do // Check last operation
apply all // Apply all scheduled operations
call something_do // Check last operation
goto out // Exit
endif
// If we are here we need to do additional backup
// But we need to delete all files before
set value counter = 0 // Sets file counter to 0
// Delete all files
jump1:
set string name_of_file = string(header) + "backup" + stringdec(value(counter)) + ".pbf"
if (fileexist(string(name_of_file)))
then
filedelete(string(name_of_file))
set value counter = value(counter) + 1
goto jump1
endif
print "Additional backup of partition"
print ""
img = string(header) + "backup.pbf" // Select filename for image
unselect all
select disk value(ndisk) // Select disk
select partition value(npart) // Select partition for backup
options
cmp = 1 // Compression = 1
label = "Additional backup" // Label
autonames // Create names automatically
store // Backup
call something_do // Check last operation
apply all // Apply all scheduled operations
call something_do // Check last operation
goto out // Exit
something_do: // Procedure for checking last operation
if (errorcode(1) != 0) // If we have error
then
print "Some error occured: " // Print message
strerror(errorcode(1)) // Print explanation of error
print ""
print "Exiting"
print ""
exit(errorcode(1)) // Exit from script
endif
endcall // End of procedure
out:
print "************************************** ALL IS OK **************************"
print ""
exit(0)